import { http } from '@/utils/http/axios';

/**
 * @description: 查询部门列表
 */
export function listDept(data = {}) {
  return http.request({
    url: '/crm/dept/list',
    method: 'post',
    data,
  });
}

/**
 * @description: 查询部门详情
 */
export function getDept(params) {
  return http.request({
    url: `/crm/dept/get`,
    method: 'get',
    params,
  });
}

/**
 * @description: 新增部门
 */
export function addDept(data = {}) {
  return http.request({
    url: '/crm/dept/create',
    method: 'post',
    data,
  });
}

/**
 * @description: 修改部门
 */
export function updateDept(data) {
  return http.request({
    url: '/crm/dept/update',
    method: 'put',
    data,
  });
}

// 删除部门
export function delDept(id = '') {
  return http.request({
    url: '/crm/dept/remove',
    method: 'delete',
    params: {
      id,
    },
  });
}

// // 查询部门列表（排除节点）
// export function listDeptExcludeChild(deptId) {
//   return http.request({
//     url: '/system/dept/list/exclude/' + deptId,
//     method: 'get',
//   });
// }

// 用户所有组织树形部门表列表
export function deptOrgList(data = {}) {
  return http.request({
    url: '/crm/dept/organization/list',
    method: 'post',
    data,
  });
}
